<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


$conexion = mysql_connect("localhost" , "root" , "a123456.");

mysql_select_db("bingo",$conexion);

$sql = "SELECT * FROM eventos order by code";

$result = mysql_query($sql);
?>
<html> 
 <head>
  <title>Eventos</title>
    <script src="media/js/jquery-2.0.2.min.js" type="text/javascript"></script>
 </head>
<body> 
  
 

<table border = '1'> 
	<tr>
		<td>Nombre de Evento</td>
		<td>Code</td>
		 <td>String</td> 
		<td>Lanzar Evento</td> 
    </tr> 
<?php while ($row = mysql_fetch_row($result)){ ?>
      
      <tr>
      	<td> <?php echo $row[1]; ?> </td>
      	<td><?php echo $row[2]; ?></td>
       	<td><?php echo $row[3]; ?></td>
       	<td><button onClick="sendEvent('<?php echo  $row[3]; ?>')" >Lanzar</button></td>
      
       </tr>

    <?php  } ?> 
  </table>
</body> 
</html>


<script>

	   function sendEvent(evento){



		 $.post("sendEvent.php",{evento:evento},function(respuesta){
			if(respuesto !== ''){
		 	   alert(respuesta); 
		 	   }
		    	   });
			    
	   }
		      
	 
</script>




